package com.mew.sas.config;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;


public enum AgentCutType {
    Slots(1, "拉霸"),
    Chess(2, "棋牌"),
    ;

    private final static Map<Integer, AgentCutType> stateMap
            = Arrays.stream(AgentCutType.values()).collect(Collectors.toMap(AgentCutType::code, code -> code));

    private final int code;
    private final String desc;

    /**
     * @param code 代码
     * @param desc 描述
     */
    AgentCutType(final int code, final String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int code() {
        return this.code;
    }
    public String desc() {
        return this.desc;
    }

    /**
     * @param code 代码
     * @return 转换出来的状态码
     */
    public static AgentCutType parse(int code) {
        return stateMap.get(code);
    }

}
